fix(macos): recover stuck Accessibility onboarding#746
Merged
Conversation
…ollow-up)
Root cause: permissions::request_accessibility() was called in setup(),
which runs BEFORE the AppKit event loop is live. On some macOS versions,
AXIsProcessTrustedWithOptions depends on the run loop for XPC to tccd.
When the event loop isn't ready, TCC may not show the dialog but still
consumes the one-time prompt. Later calls from the onboarding page's
'grant accessibility' button silently return Denied, trapping users on
the onboarding page. Recovery requires System Settings grant + app
restart, but users had no clear restart action — only a text hint.
Changes:
- lib.rs: Remove setup() TCC prompt. The prompt is now exclusively
triggered by user action on the onboarding page, aligning with
Apple HIG (explain why → then prompt).
- Onboarding.tsx:
* onGrantAccessibility now checks the TCC result: skip
openSystemSettings when already granted (previously always opened)
* New tccPromptShown state distinguishes 'never attempted' vs
'already denied' for correct button labels
* Denied state now shows a prominent 'Restart OpenLess' button
calling restartApp()
- PermissionsSection.tsx: Same fix for settings page accessibility
row — check TCC result, guide to System Settings when denied,
show 'Restart App' button
- i18n: Add onboarding.actionRestart + settings.permissions.restart
for zh-CN / zh-TW / en / ja / ko
Closes: macos-onboarding-accessibility-stuck
Contributor
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
Summary
Why
Users reported macOS onboarding staying on the OpenLess authorization page even after granting Accessibility, and manual remove/re-grant could still leave System Settings checked while AXIsProcessTrusted() returned false. That points to a TCC/app identity recovery problem, not just a missing UI refresh.
This PR keeps the prompt aligned with Apple’s expected user-initiated permission flow and gives stuck users an in-app reset path for the current bundle id.
Verification
Note: cargo fmt --check currently reports existing repository-wide formatting differences unrelated to this PR, so I did not format unrelated files.
PR Type
Bug fix, Enhancement
Description
Remove early startup TCC prompt to prevent stuck onboarding
Add dedicated Accessibility reset + restart command for stuck state recovery
Update UI to distinguish first prompt from denied state
Add i18n labels for reset action
Diagram Walkthrough
flowchart LR A[App start] --> B[Onboarding page] B --> C{Accessibility status} C -- notDetermined --> D[Show "Grant" button] D --> E[User clicks Grant] E --> F{TCC dialog result} F -- granted --> G[Continue onboarding] F -- denied --> H[Show "Open System Settings"] H --> I[User may become stuck] C -- denied --> J[Check if prompt already shown?] J -- yes --> K[Show "Reset & Restart" button] K --> L[Reset TCC and restart app]File Walkthrough
2 files
Remove early TCC prompt and add reset+restart commandUpdate permissions section to show reset button when denied3 files
Update onboarding to handle permission states and add restart buttonExport new reset method from IPC moduleAdd IPC function for resetting accessibility and restarting5 files
Add English i18n keys for reset actionAdd Japanese i18n keys for reset actionAdd Korean i18n keys for reset actionAdd Simplified Chinese i18n keys for reset actionAdd Traditional Chinese i18n keys for reset action